package com.consumer.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import com.consumer.client.fallback.UserClientFallback;
import com.consumer.config.FeignConfig;
import com.consumer.pojo.User;

/**
 * Feign客户端，指定服务名为my-system； 
 * fallback：指定降级类； 
 * configuration：指定日志配置类
 * 
 * @author gzp
 *
 */
@FeignClient(value = "my-system", fallback = UserClientFallback.class, configuration = FeignConfig.class)
public interface UserClient {

	/**
	 * 拼接地址为http://my-system/user/1
	 * PathVariable注解加上参数value，不然启动可能会报错
	 * 
	 * @param id
	 * @return
	 */
	@GetMapping("/user/{id}")
	public User getById(@PathVariable(value = "id") String id);
}
